//
//  ThreeViewController.m
//  TransitionAnimation
//
//  Created by tgs on 2017/6/28.
//  Copyright © 2017年 tgs. All rights reserved.
//

#import "ThreeViewController.h"
#import "TransitionPushObj.h"

@interface ThreeViewController ()

@end

@implementation ThreeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"详情页";
    self.view.backgroundColor = [UIColor whiteColor];
    UIImageView *imageView = [[UIImageView alloc] init];
    self.imageView = imageView;
//    imageView = self.imageView;
    [self.view addSubview:imageView];
    imageView.center = CGPointMake(self.view.center.x, self.view.center.y - self.view.bounds.size.height / 2 + 210);
    imageView.bounds = CGRectMake(0, 0, 280, 280);
    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, imageView.frame.size.height + imageView.frame.origin.y, self.view.bounds.size.width - 40, 50)];
    textView.text = @"push动画";
    textView.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:textView];
    
}




- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC{
    NSLog(@"%@", NSStringFromCGRect(self.imageView.frame));
    //分pop和push两种情况分别返回动画过渡代理相应不同的动画操作
    return [TransitionPushObj transitionWithType:operation == UINavigationControllerOperationPush ? NaviOneTransitionTypePush : NaviOneTransitionTypePop];
}

//- (id<UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)animationController{
//    //手势开始的时候才需要传入手势过渡代理，如果直接点击pop，应该传入空，否者无法通过点击正常pop
//    return _interactiveTransition.interation ? _interactiveTransition : nil;
//}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
